<html>
<script>
function createClass(conf){

    function _injectAttribute(fn){
        var prototype = fn.prototype;
        for(var publicName in publics){
            if(!publics.hasOwnProperty(publicName))
                continue;
            if(typeof publics[publicName]=="function")
                prototype[publicName] = function(publicName){
                    return function(){
                        return publics[publicName].apply(privates, arguments);
                    }
                }(publicName);
            else 
                prototype[publicName] = publics[publicName];
            if(!privates[publicName])
                privates[publicName] = prototype[publicName];
        }
        return fn;
    }

    var publics, privates;
        publics = conf.publics;
        privates = conf.privates || new Object();

    var fn = function(fn){
    	return function(){
    		return fn.apply(privates, arguments);
    	};
    }(conf.constructor || new Function());

    return _injectAttribute(fn);
}

var MyClass = createClass({
    constructor:function(){
        console.log("constructor is called: " + this.message);
    },
    publics:{
        message:"Hello, World",
        sayJavaScript:function(){
            return this._message;
        },
        sayABAP:function(msg){
            return msg + ", " + this.ABAP();
        }
    },
    privates:{
        _message: "Hello, JavaScript",
        ABAP :function(){
            return "ABAP";
        }
    }
});
/*
var myClassInstance = new MyClass();

console.log(myClassInstance.message);
console.log(myClassInstance.sayJavaScript());
console.log(myClassInstance.sayABAP("Hello"));
console.log(myClassInstance._message);
console.log(myClassInstance.ABAP());
*/

class Developer {
    constructor(name, language) {
        this.workingLanguage = language;
        let _name = name;

        let _getName = function() { 
            return _name; 
        };
        this.getName = _getName;
    }
}

var Jerry = new Developer("Jerry", "Java");
var Ji = new Developer("Ji", "JavaScript");

console.log("Developer name: " + Jerry.getName());
console.log("Jerry's working language: " + Jerry.workingLanguage);
console.log("local function accessible? " + Jerry._getName);
console.log("Jerry's name: " + Jerry._name);


</script>
</html>